"""
__project__ = 'py_test'
__file_name__ = 'test2'
__author__ = 'yiyi'
__time_ = '2020/10/28 0028 下午 1:51'
__product_name = 'lesson1'
-*- coding:utf-8 -*-
"""
print("hello word")


import  requests
import csv

class shdyyss():

    def __init__(self):
        self.url="http://shop.uat.zgmmtuan.com/capi/customer/public/login"

    def tests(self):
        #创建
        f=open("ceshi.csv","r")
        f2=open("ceshi3.csv","w")
        #全部读测试数据
        table=csv.reader(f)
        #一行行读并放入字典中
        dic={}
        for row in table:
              dic["telephone"]=row[0]
              dic["checkCode"] =row[1]
              dic["word"] =row[2]
              w=requests.session()
              respones=w.post(self.url,data= dic).text
              print(respones)

              t=respones.find(row[2])
              if t>0:
                 print("测试通过")
                 f2.write(row[0]+","+row[1]+','+row[2]+','+"测试通过"+'\n')
              else:
                print("测试不通过")
                f2.write(row[0]+","+row[1]+','+row[2]+','+"测试不通过"+'\n')

        f2.close()

if __name__ == '__main__':
      duixiang= shdyyss()
      duixiang.tests()
